package com.lb.uts.entity;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * 定时任务表
 * </p>
 *
 * @author liangb
 * @since 2019-04-26
 */

public class ScheduleJob implements Serializable {

    private static final long serialVersionUID = 7768896805643442525L;
    /**
     * 定时任务ID
     */
    @TableId
    private String jobId;

    /**
     * 定时任务名称
     */
    private String jobName;

    /**
     * 定时任务分组名称
     */
    private String jobGroup;

    /**
     * 定时任务状态，0：正常，1：暂停，2：删除
     */
    private String jobStatus;

    /**
     * 触发器表达式
     */
    private String cronExpression;

    /**
     * 任务描述
     */
    private String jobDesc;

    /**
     * 属于什么系统
     */
    private String systemName;

    /**
     * 调用服务的名称
     */
    private String service;

    /**
     * 调用服务的方法
     */
    private String method;

    /**
     * 版本号,记录修改次数
     */
    private Long version;

    /**
     * 报警邮件，可多个，以逗号隔开
     */
    private String alarmEmail;

    /**
     * 并发数量:0不做限制
     */
    private Integer concurrentNum;

    private Integer runNum;

    /**
     * 请求参数
     */
    private String parameters;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    /**
     * 依赖的任务
     */
    private String depend;

    /**
     * 希望的过期时间（单位：s）
     */
    private Long expireTime;

    /**
     * 是否多台执行，00：否 01：是
     */
    private String slave;

    /**
     * 执行策略
     * 00：随机 01：批量 02:权重
     */
    private String policyType;

    /**
     * 抢占式，记录当前的执行器
     */
    private String possession;

    /**
     * 脚本类型
     */
    private Integer taskType;

    /**
     * 脚本路径
     */
    private String scriptPath;


    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + jobGroup.hashCode();
        result = 31 * result + jobName.hashCode();
        return result;
    }

    /**
     * 用于刷新时，对象的比较
     *
     * @param scheduleJob
     * @return
     */
    public boolean equals(ScheduleJob scheduleJob) {
        return scheduleJob.getJobName().equals(this.jobName) && scheduleJob.getJobGroup().equals(this.jobGroup);
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public String getJobGroup() {
        return jobGroup;
    }

    public void setJobGroup(String jobGroup) {
        this.jobGroup = jobGroup;
    }

    public String getJobStatus() {
        return jobStatus;
    }

    public void setJobStatus(String jobStatus) {
        this.jobStatus = jobStatus;
    }

    public String getCronExpression() {
        return cronExpression;
    }

    public void setCronExpression(String cronExpression) {
        this.cronExpression = cronExpression;
    }

    public String getJobDesc() {
        return jobDesc;
    }

    public void setJobDesc(String jobDesc) {
        this.jobDesc = jobDesc;
    }

    public String getSystemName() {
        return systemName;
    }

    public void setSystemName(String systemName) {
        this.systemName = systemName;
    }

    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

    public String getAlarmEmail() {
        return alarmEmail;
    }

    public void setAlarmEmail(String alarmEmail) {
        this.alarmEmail = alarmEmail;
    }

    public Integer getConcurrentNum() {
        return concurrentNum;
    }

    public void setConcurrentNum(Integer concurrentNum) {
        this.concurrentNum = concurrentNum;
    }

    public Integer getRunNum() {
        return runNum;
    }

    public void setRunNum(Integer runNum) {
        this.runNum = runNum;
    }

    public String getParameters() {
        return parameters;
    }

    public void setParameters(String parameters) {
        this.parameters = parameters;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public String getDepend() {
        return depend;
    }

    public void setDepend(String depend) {
        this.depend = depend;
    }

    public Long getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Long expireTime) {
        this.expireTime = expireTime;
    }

    public String getSlave() {
        return slave;
    }

    public void setSlave(String slave) {
        this.slave = slave;
    }

    public String getPolicyType() {
        return policyType;
    }

    public void setPolicyType(String policyType) {
        this.policyType = policyType;
    }

    public String getPossession() {
        return possession;
    }

    public void setPossession(String possession) {
        this.possession = possession;
    }

    public Integer getTaskType() {
        return taskType;
    }

    public void setTaskType(Integer taskType) {
        this.taskType = taskType;
    }

    public String getScriptPath() {
        return scriptPath;
    }

    public void setScriptPath(String scriptPath) {
        this.scriptPath = scriptPath;
    }

    @Override
    public String toString() {
        return "ScheduleJob{" +
                "jobId='" + jobId + '\'' +
                ", jobName='" + jobName + '\'' +
                ", jobGroup='" + jobGroup + '\'' +
                ", jobStatus='" + jobStatus + '\'' +
                ", cronExpression='" + cronExpression + '\'' +
                ", jobDesc='" + jobDesc + '\'' +
                ", systemName='" + systemName + '\'' +
                ", service='" + service + '\'' +
                ", method='" + method + '\'' +
                ", version=" + version +
                ", alarmEmail='" + alarmEmail + '\'' +
                ", concurrentNum=" + concurrentNum +
                ", runNum=" + runNum +
                ", parameters='" + parameters + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", depend='" + depend + '\'' +
                ", expireTime=" + expireTime +
                ", slave='" + slave + '\'' +
                ", policyType='" + policyType + '\'' +
                ", possession='" + possession + '\'' +
                ", taskType=" + taskType +
                ", scriptPath='" + scriptPath + '\'' +
                '}';
    }
}
